package is.glif.fenius.client.draft.beans;

public class ClientConfig {
    private EndpointInfo[] endpointInfos;
    private RequestSet[] requestSets;
    private Request[] requests;
    private ServerInfo[] serverInfos;
    private boolean useSSL;
    private boolean useBasicHttpAuth;
    private String httpUsername;
    private String httpPassword;
    private String sslKeystorePath;
    private String sslKeystorePass;
    private String sslTruststorePath;
    private String sslTruststorePass;
    private Integer httpTimeout;
    
    
    
    public boolean isUseSSL() {
        return useSSL;
    }
    public void setUseSSL(boolean useSSL) {
        this.useSSL = useSSL;
    }
    public boolean isUseBasicHttpAuth() {
        return useBasicHttpAuth;
    }
    public void setUseBasicHttpAuth(boolean useBasicHttpAuth) {
        this.useBasicHttpAuth = useBasicHttpAuth;
    }
    public String getHttpUsername() {
        return httpUsername;
    }
    public void setHttpUsername(String httpUsername) {
        this.httpUsername = httpUsername;
    }
    public String getHttpPassword() {
        return httpPassword;
    }
    public void setHttpPassword(String httpPassword) {
        this.httpPassword = httpPassword;
    }
    public String getSslKeystorePath() {
        return sslKeystorePath;
    }
    public void setSslKeystorePath(String sslKeystorePath) {
        this.sslKeystorePath = sslKeystorePath;
    }
    public String getSslKeystorePass() {
        return sslKeystorePass;
    }
    public void setSslKeystorePass(String sslKeystorePass) {
        this.sslKeystorePass = sslKeystorePass;
    }
    public String getSslTruststorePath() {
        return sslTruststorePath;
    }
    public void setSslTruststorePath(String sslTruststorePath) {
        this.sslTruststorePath = sslTruststorePath;
    }
    public String getSslTruststorePass() {
        return sslTruststorePass;
    }
    public void setSslTruststorePass(String sslTruststorePass) {
        this.sslTruststorePass = sslTruststorePass;
    }
    public ClientConfig() {
    }
    public EndpointInfo[] getEndpointInfos() {
        return endpointInfos;
    }
    public void setEndpointInfos(EndpointInfo[] endpointInfos) {
        this.endpointInfos = endpointInfos;
    }
    public RequestSet[] getRequestSets() {
        return requestSets;
    }
    public void setRequestSets(RequestSet[] requestSets) {
        this.requestSets = requestSets;
    }
    public Request[] getRequests() {
        return requests;
    }
    public void setRequests(Request[] requests) {
        this.requests = requests;
    }
    public ServerInfo[] getServerInfos() {
        return serverInfos;
    }
    public void setServerInfos(ServerInfo[] serverInfos) {
        this.serverInfos = serverInfos;
    }

    
    public RequestSet getRequestSet(String requestSetId) {
        RequestSet result = null;
        if (requestSets == null) return null;
        for (RequestSet tmp : requestSets) {
            if (tmp == null) continue;
            if (tmp.getId().equals(requestSetId)) {
                return tmp;
            }
        }
        
        return result;
    }

    public Request getRequest(String requestId) {
        Request result = null;
        for (Request tmp : requests) {
            if (tmp.getId().equals(requestId)) {
                return tmp;
            }
        }
        
        return result;
    }

    public ServerInfo getServerInfo(String serverId) {
        ServerInfo result = null;
        for (ServerInfo tmp : serverInfos) {
            if (tmp.getId().equals(serverId)) {
                return tmp;
            }
        }
        
        return result;
    }
    
    public EndpointInfo getEndpointInfo(String endpointId) {
        EndpointInfo result = null;
        for (EndpointInfo tmp : endpointInfos) {
            if (tmp.getId().equals(endpointId)) {
                return tmp;
            }
        }
        
        return result;
    }
	public void setHttpTimeout(Integer httpTimeout) {
		this.httpTimeout = httpTimeout;
	}
	public Integer getHttpTimeout() {
		return httpTimeout;
	}
}
